﻿<%@ Page Title="Manage Purchase Requisition" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="pr.aspx.vb" Inherits="manage_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <h2>Purchase Requisition List</h2>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="pr_key" DataSourceID="SqlPRParent" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
                <asp:BoundField DataField="pr_key" HeaderText="pr_key" InsertVisible="False" ReadOnly="True" SortExpression="pr_key" Visible="False" />
                <asp:BoundField DataField="pr_no" HeaderText="No" SortExpression="pr_no" />
                <asp:BoundField DataField="requisitioner" HeaderText="Requisitioner" SortExpression="requisitioner" />
                <asp:BoundField DataField="type" HeaderText="Type" SortExpression="type" />
                <asp:BoundField DataField="priority" HeaderText="Priority" SortExpression="priority" />
                <asp:BoundField DataField="prepared" HeaderText="Prepared" SortExpression="prepared" />
                <asp:BoundField DataField="prepared_date" HeaderText="prepared_date" SortExpression="prepared_date" Visible="False" />
                <asp:BoundField DataField="recommend" HeaderText="Recommend" SortExpression="recommend" />
                <asp:BoundField DataField="recommend_date" HeaderText="recommend_date" SortExpression="recommend_date" Visible="False" />
                <asp:BoundField DataField="approved" HeaderText="Approved" SortExpression="approved" />
                <asp:BoundField DataField="approved_date" HeaderText="approved_date" SortExpression="approved_date" Visible="False" />
                <asp:BoundField DataField="canvassed" HeaderText="Canvassed" SortExpression="canvassed" />
                <asp:BoundField DataField="canvassed_date" HeaderText="canvassed_date" SortExpression="canvassed_date" Visible="False" />
                <asp:BoundField DataField="approvePO" HeaderText="Approved PR" SortExpression="approvePO" />
                <asp:BoundField DataField="approvePO_date" HeaderText="Date" SortExpression="approvePO_date" />
                <asp:BoundField DataField="time_stamp" HeaderText="time_stamp" SortExpression="time_stamp" Visible="False" />
                <asp:BoundField DataField="uploaded_by" HeaderText="uploaded_by" SortExpression="uploaded_by" />
                <asp:BoundField DataField="company" HeaderText="Company" SortExpression="company" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
       <h3> Items </h3>
        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="po_itemkey" DataSourceID="SqlPRItem" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="po_itemkey" HeaderText="po_itemkey" InsertVisible="False" ReadOnly="True" SortExpression="po_itemkey" Visible="False" />
                <asp:BoundField DataField="po_no" HeaderText="po_no" SortExpression="po_no" Visible="False" />
                <asp:BoundField DataField="quantity" HeaderText="Quantity" SortExpression="quantity" />
                <asp:BoundField DataField="unit" HeaderText="Unit" SortExpression="unit" />
                <asp:BoundField DataField="description" HeaderText="Description" SortExpression="description" />
                <asp:BoundField DataField="remarks" HeaderText="Remarks" SortExpression="remarks" />
                <asp:BoundField DataField="time_stamp" HeaderText="time_stamp" SortExpression="time_stamp" Visible="False" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
    <p>
        <asp:SqlDataSource ID="SqlPRParent" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" DeleteCommand="DELETE FROM [pr_parents] WHERE [pr_key] = @pr_key" InsertCommand="INSERT INTO [pr_parents] ([pr_no], [requisitioner], [type], [priority], [prepared], [prepared_date], [recommend], [recommend_date], [approved], [approved_date], [canvassed], [canvassed_date], [approvePO], [approvePO_date], [time_stamp], [uploaded_by], [company]) VALUES (@pr_no, @requisitioner, @type, @priority, @prepared, @prepared_date, @recommend, @recommend_date, @approved, @approved_date, @canvassed, @canvassed_date, @approvePO, @approvePO_date, @time_stamp, @uploaded_by, @company)" SelectCommand="SELECT * FROM [pr_parents]" UpdateCommand="UPDATE [pr_parents] SET [pr_no] = @pr_no, [requisitioner] = @requisitioner, [type] = @type, [priority] = @priority, [prepared] = @prepared, [prepared_date] = @prepared_date, [recommend] = @recommend, [recommend_date] = @recommend_date, [approved] = @approved, [approved_date] = @approved_date, [canvassed] = @canvassed, [canvassed_date] = @canvassed_date, [approvePO] = @approvePO, [approvePO_date] = @approvePO_date, [time_stamp] = @time_stamp, [uploaded_by] = @uploaded_by, [company] = @company WHERE [pr_key] = @pr_key">
            <DeleteParameters>
                <asp:Parameter Name="pr_key" Type="Int64" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="pr_no" Type="String" />
                <asp:Parameter Name="requisitioner" Type="String" />
                <asp:Parameter Name="type" Type="String" />
                <asp:Parameter Name="priority" Type="String" />
                <asp:Parameter Name="prepared" Type="String" />
                <asp:Parameter Name="prepared_date" Type="String" />
                <asp:Parameter Name="recommend" Type="String" />
                <asp:Parameter Name="recommend_date" Type="String" />
                <asp:Parameter Name="approved" Type="String" />
                <asp:Parameter Name="approved_date" Type="String" />
                <asp:Parameter Name="canvassed" Type="String" />
                <asp:Parameter Name="canvassed_date" Type="String" />
                <asp:Parameter Name="approvePO" Type="String" />
                <asp:Parameter Name="approvePO_date" Type="String" />
                <asp:Parameter Name="time_stamp" Type="String" />
                <asp:Parameter Name="uploaded_by" Type="String" />
                <asp:Parameter Name="company" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="pr_no" Type="String" />
                <asp:Parameter Name="requisitioner" Type="String" />
                <asp:Parameter Name="type" Type="String" />
                <asp:Parameter Name="priority" Type="String" />
                <asp:Parameter Name="prepared" Type="String" />
                <asp:Parameter Name="prepared_date" Type="String" />
                <asp:Parameter Name="recommend" Type="String" />
                <asp:Parameter Name="recommend_date" Type="String" />
                <asp:Parameter Name="approved" Type="String" />
                <asp:Parameter Name="approved_date" Type="String" />
                <asp:Parameter Name="canvassed" Type="String" />
                <asp:Parameter Name="canvassed_date" Type="String" />
                <asp:Parameter Name="approvePO" Type="String" />
                <asp:Parameter Name="approvePO_date" Type="String" />
                <asp:Parameter Name="time_stamp" Type="String" />
                <asp:Parameter Name="uploaded_by" Type="String" />
                <asp:Parameter Name="company" Type="String" />
                <asp:Parameter Name="pr_key" Type="Int64" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlPRItem" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" SelectCommand="SELECT * FROM [pr_items] WHERE ([po_no] = @po_no)" DeleteCommand="DELETE FROM [pr_items] WHERE [po_itemkey] = @po_itemkey" InsertCommand="INSERT INTO [pr_items] ([po_no], [quantity], [unit], [description], [remarks], [time_stamp]) VALUES (@po_no, @quantity, @unit, @description, @remarks, @time_stamp)" UpdateCommand="UPDATE [pr_items] SET [po_no] = @po_no, [quantity] = @quantity, [unit] = @unit, [description] = @description, [remarks] = @remarks, [time_stamp] = @time_stamp WHERE [po_itemkey] = @po_itemkey">
            <DeleteParameters>
                <asp:Parameter Name="po_itemkey" Type="Int64" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="po_no" Type="String" />
                <asp:Parameter Name="quantity" Type="String" />
                <asp:Parameter Name="unit" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="remarks" Type="String" />
                <asp:Parameter Name="time_stamp" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:SessionParameter Name="po_no" SessionField="PR_NO" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="po_no" Type="String" />
                <asp:Parameter Name="quantity" Type="String" />
                <asp:Parameter Name="unit" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="remarks" Type="String" />
                <asp:Parameter Name="time_stamp" Type="String" />
                <asp:Parameter Name="po_itemkey" Type="Int64" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>

